/* Copyright 2001,2002,2003 NAH6 BV
 * All Rights Reserved
 *
 *  $Header: /var/lib/cvs/secphone/ui/KeyExchange/dhCalcSharedSecretRequest.cpp,v 1.6 2003/11/21 12:39:24 itsme Exp $
 *
 *
 *  calculate the diffiehellman shared secret.
 *
 */

#include "dhCalcSharedSecretRequest.h"

//------------------------------------------------------------------
// calculation thread
bool CalcSharedSecretRequest::doCalculation()
{
    debug("DH: calculating shared secret\n");

    m_shared_secret= m_other_public.ModularPower(m_my_secret, m_modulus_prime);

    // check for certain insane values
    if (m_shared_secret<=1 || m_shared_secret>=m_modulus_prime-1)
        return false;

    return true;
}

